/**
 * 
 */
package org.third.security.crypto;


import java.util.Random;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;

/**
 * @author gongyo
 *
 */
public class JasyptCocurrentTest {
    static class JasyptThread implements Runnable {
        /*
         * (non-Javadoc)
         * @see java.lang.Runnable#run()
         */
        AtomicInteger counter;
        AtomicLong previousTime;

        /**
         * @param counter2
         * @param start
         */
        public JasyptThread(AtomicInteger counter2, AtomicLong start) {
            counter = counter2;
            this.previousTime = start;
        }

        @Override
        public void run() {
            while (counter.getAndIncrement() < 100000) {
                try {
                    SecurityHelper.decrypt(SecurityHelper.encrypt(UUID.randomUUID().toString()));
                    if (counter.get() % 10000 == 0) {
                        long currentTime= System.currentTimeMillis();
                        System.out.println("print " + counter.get()+" take "+(currentTime-previousTime.get()));
//                        previousTime.set(currentTime);
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

        }
    }

    public static void main(String[] args) {
//        AtomicInteger counter = new AtomicInteger(1);
//        AtomicLong previousTime = new AtomicLong(System.currentTimeMillis());
//
//        for (int i = 0; i < 100; i++) {
//            new Thread(new JasyptThread(counter, previousTime)).start();
//        }
        System.out.println(SecurityHelper.decrypt("ENC(pDqB35hqy8WgBZ4Q1Gs5MbS8xDHpepd1k6Z/7pJ2M0feeXwJK/6e3BvYvs+sb8Y6)"));
        
    }

}
